package com.gitee.wsl.mathematics.vector.ext

import com.gitee.wsl.mathematics.vector.Vector
import com.gitee.wsl.mathematics.complex.quaternion.Quaternion
import com.gitee.wsl.mathematics.vector.vec2.Vector2
import com.gitee.wsl.mathematics.vector.vec3.Vector3
import com.gitee.wsl.mathematics.vector.vec4.Vector4

/*
operator fun<K: Vector2<T, *>> times(other: K) = other.create(x * other.x, y * other.y)
operator fun<K: Vector3<T, *>> times(other: K) = other.create(x * other.x, y * other.y, zero)
operator fun<K: Vector4<T, *>> times(other: K) = other.create(x * other.x, y * other.y, zero, zero)
operator fun times(rotation: Quaternion<T, *>) = rotation * vec3

operator fun<K: Vector2<T, *>> times(other: K) =       create(x * other.x, y * other.y, zero)
operator fun<K: Vector3<T, *>> times(other: K) = other.create(x * other.x, y * other.y, z * other.z)
operator fun<K: Vector4<T, *>> times(other: K) = other.create(x * other.x, y * other.y, z * other.z, zero)
operator fun times(rotation: Quaternion<T, *>) = rotation * this


operator fun times(other: Vector2<T, *>) = create(x * other.x, y * other.y, zero, zero)
operator fun times(other: Vector3<T, *>) = create(x * other.x, y * other.y, z * other.z, zero)
operator fun times(other: Vector4<T, *>) = create(x * other.x, y * other.y, z * other.z, w * other.w)
*/

operator fun <T:Number,V: Vector<T, V>> Number.times(vec: Vector<T, V>):V = vec.times(this)
infix fun <T:Number,V: Vector<T, V>> Number.x(vec: Vector<T, V>):V = vec.times(this)
//operator fun <T:Number,V: Vector2<T, V>> Number.times(vec: V):V = vec.times(this)
//operator fun <T:Number,V: Vector3<T, V>> Number.times(vec: V):V = vec.times(this)
//operator fun <T:Number,V: Vector4<T, V>> Number.times(vec: V):V = vec.times(this)


//operator fun<T:Number> Vector2<T, *>.times(other: Vector2<T, *>) = create(x * other.x, y * other.y) as Vector2<T, *>

operator fun<T:Number,K: Vector2<T, K>> Vector2<T, K>.times(other: Vector2<T, *>) = create(x * other.x, y * other.y)
operator fun<T:Number,K: Vector3<T, K>> Vector2<T, *>.times(other: K) = other.create(x * other.x, y * other.y, zero)
operator fun<T:Number,K: Vector4<T, K>> Vector2<T, *>.times(other: K) = other.create(x * other.x, y * other.y, zero, zero)

operator fun<T:Number,V: Vector3<T, V>> Vector3<T, V>.times(other: Vector2<T, *>) = create(x * other.x, y * other.y, zero)
operator fun<T:Number,K: Vector3<T, K>> Vector3<T, K>.times(other: Vector3<T, *>) = create(x * other.x, y * other.y, z * other.z)
operator fun<T:Number,K: Vector4<T, K>> Vector3<T, *>.times(other: K)             = other.create(x * other.x, y * other.y, z * other.z, zero)
operator fun<T:Number,K: Quaternion<T, K>> Vector3<T, *>.times(rotation: K) = rotation.conjugate * this

operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.times(other: Vector2<T, *>) = create(x * other.x, y * other.y, zero, zero)
operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.times(other: Vector3<T, *>) = create(x * other.x, y * other.y, z * other.z, zero)
operator fun<T:Number,V: Vector4<T, V>> Vector4<T, V>.times(other: Vector4<T, *>) = create(x * other.x, y * other.y, z * other.z, w * other.w)
